package com.lemon.blog.web.domain;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.lemon.common.core.annotation.Excel;
import com.lemon.common.core.base.BaseEntity;
import com.lemon.common.core.serializer.JsonLongDeserializer;
import com.lemon.common.core.serializer.JsonLongSerializer;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 标签管理对象 bl_tag
 * 
 * @author huangpeng
 * @date 2022-04-23
 */
public class BlTag extends BaseEntity implements Comparable<BlTag>
{
    private static final long serialVersionUID = 1L;

    /** 标签id */
    @JsonSerialize(using = JsonLongSerializer.class)
    @JsonDeserialize(using = JsonLongDeserializer.class)
    private Long id;

    /** 标签名 */
    @Excel(name = "标签名")
    private String tagName;

    /** 帖子数 */
    @Excel(name = "帖子数")
    private Integer tagBlogCount;

    /** 乐观锁 */
    private Long version;

    /** 是否删除，0否1是 */
    private String delFlag;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setTagName(String tagName) 
    {
        this.tagName = tagName;
    }

    public String getTagName() 
    {
        return tagName;
    }
    public void setTagBlogCount(Integer tagBlogCount)
    {
        this.tagBlogCount = tagBlogCount;
    }

    public Integer getTagBlogCount()
    {
        return tagBlogCount;
    }
    public void setVersion(Long version) 
    {
        this.version = version;
    }

    public Long getVersion() 
    {
        return version;
    }
    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("tagId", getId())
            .append("tagName", getTagName())
            .append("tagBlogCount", getTagBlogCount())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .append("version", getVersion())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
            .append("updateBy", getUpdateBy())
            .append("remark", getRemark())
            .toString();
    }

    @Override
    public int compareTo(BlTag newTag) {
        return Long.compare(newTag.getTagBlogCount(), this.getTagBlogCount());
    }
}
